﻿CREATE PROCEDURE [dbo].[Inventories_SelectTotalStoresAndLastUpdate]
	@RangeReviewId int
AS
	SELECT 
		COUNT(distinct inv.StoreId) as TotalStores, 
		MAX(inv.Date) as LastDate
    FROM Inventories inv
    inner join Articles ar on inv.ArticleId = ar.Id
    WHERE ar.RangeReviewId = @RangeReviewId

	return 0